//
//  NetManager+ServerURL.swift
//  SReader
//
//  Created by JunMing on 2021/6/19.
//  Copyright © 2021 赵俊明. All rights reserved.
//

import UIKit

extension NetManager {
    /// 生成tts语音
    static func ai_tts(text: String, output: String, callback: Completion<Responsed>?) {
        struct Parameter: Encodable {
            var text: String
            var output: String
            var voice: String
        }
        
        var voice = "zh-CN-XiaoxiaoNeural"
        let p = Parameter(text: text, output: output, voice: voice)
        let request = HttpRequest(doman: .ali, target: .tts)
        requestModel(url: request, method: .POST, postData: p, completion: callback)
    }
    
    /// 本地tts
    static func ai_tts_local(text: String, output: String, callback: Completion<Responsed>?) {
        struct Parameter: Encodable {
            var content: String
            var output: String
        }
        let p = Parameter(content: text, output: output)
        let request = HttpRequest(doman: .mac, target: .localTTS)
        requestModel(url: request, method: .POST, postData: p, completion: callback)
    }
}
